﻿using Fozzy;
using Fozzy.Skin;
using System;
using System.Windows;
using System.Windows.Interop;

namespace Microsoft.FamilyShow
{
    class Dialog                                                            : File_Dialog
    {
        #region States
            private bool                With_Window                         { get { return this.Exist(Application.Current.MainWindow)       ; } }
        #endregion

        #region Properties
            public override Name        Name                                { get { return new Builder(Instances).Name                      ; } }
            protected override method   Method                              { get { return method.Open                                      ; } }
        #endregion

        #region Constructeur
            public Dialog(System.Type type, Environment.SpecialFolder folder): base(type, new Directory(folder))
            { }
            public Dialog(System.Type type, Directory directory)            : base(type, directory)
            {}
        #endregion

            protected override void Prepare()
            {
                base.Prepare()                                              ;
                Add(new Import(Name))                                       ;
                Add(new Export(Name))                                       ;
                Add(new WhatIs(Name))                                       ;
                Own()                                                       ;
                Execute()                                                   ;
            }

            private void Own()
            {
                if (With_Window) Set(new WindowInteropHelper(Application.Current.MainWindow).Handle);
            }

            protected void Add(Fozzy.Filter filter)
            { }

            public override void Execute()
            {
                //base.Execute();
                Show()                                                      ;
            }
    }

}
